package com.carolouvindam.View;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.Button;
import com.carolouvindam.Model.OrderPriority;
import com.carolouvindam.R;

public class PriorityButton extends Button {

    public PriorityButton(Context context, AttributeSet attrs) {
        super(context, attrs);
        setValue(OrderPriority.Normal);
    }

    public PriorityButton(Context context) {
        this(context, OrderPriority.Normal);
    }

    public PriorityButton(Context context, OrderPriority priority) {
        super(context);
        setValue(priority);
    }

    public void setValue(OrderPriority prior) {
        Resources res = getResources();
        if (prior.toString() == OrderPriority.VHigh.toString()) {
            Drawable shape = res.getDrawable(R.drawable.order5);
            this.setBackgroundDrawable(shape);

        }
        if (prior.toString() == OrderPriority.High.toString()) {
            Drawable shape = res.getDrawable(R.drawable.order4);
            this.setBackgroundDrawable(shape);

        }

        if (prior.toString() == OrderPriority.Normal.toString()) {
            Drawable shape = res.getDrawable(R.drawable.order3);
            this.setBackgroundDrawable(shape);
        }

        if (prior.toString() == OrderPriority.Low.toString()) {
            Drawable shape = res.getDrawable(R.drawable.order2);
            this.setBackgroundDrawable(shape);
        }
        if (prior.toString() == OrderPriority.VLow.toString()) {
            Drawable shape = res.getDrawable(R.drawable.order1);
            this.setBackgroundDrawable(shape);
        }
    }

}
